ball = {}
  ball.image = Image.load ("balle.png", VRAM)
  ball.x = 5
  ball.y = 5
  ball.x2 = ball.x+Image.width (ball.image)
  ball.y2 = ball.y+Image.height (ball.image)

brick = {}
  brick.image = Image.load ("brique.png", VRAM)
  brick.x = 25
  brick.y = 5
  brick.x2 = brick.x+Image.width (brick.image)
  brick.y2 = brick.y+Image.height (brick.image)

Collisions.newObject ("balle", SCREEN_DOWN, ball.x, ball.y, ball.x2, ball.y2)
Collisions.newObject ("brick", SCREEN_DOWN, brick.x, brick.y, brick.x2, brick.y2, "Image")

while not Keys.newPress.Start do
   
  Controls.read()
  
  ball.x2 = ball.x+Image.width (ball.image)
  ball.y2 = ball.y+Image.height (ball.image)
  
  Collisions.update ("balle", ball.x, ball.y, ball.x2, ball.y2)
  
  startDrawing()
    
    Collisions.initCollision ("balle", "brick")
    
    screen.blit (SCREEN_DOWN, ball.x, ball.y, ball.image)
    
    Collisions.drawObject ("brick", brick.image)
    
    if Keys.held.Right and Collisions.mode ("balle") ~= "right" then
      ball.x = ball.x+1
    end
    if Keys.held.Down and Collisions.mode ("balle") ~= "down" then
      ball.y = ball.y+1
    end
    if Keys.held.Left and Collisions.mode ("balle") ~= "left" then
      ball.x = ball.x-1
    end
    if Keys.held.Up and Collisions.mode ("balle") ~= "up" then
      ball.y = ball.y-1
    end
    
    screen.print(SCREEN_UP, 0, 0, CO["balle"].collisionMode)
    
  stopDrawing()

end

Image.destroy (ball.image)
Image.destroy (brick.image)
Collisions.destroyObject ("balle")
Collisions.destroyObject ("brick")
ball = nil
brick = nil
